package com.heer.gymnasium.module.coach.beans;

import com.heer.gymnasium.base.BaseBean;
import com.heer.gymnasium.module.article.beans.ArticleBean;
import com.heer.gymnasium.module.article.beans.ArticleResponseBean;
import com.heer.gymnasium.module.common.beans.GlobeBean;
import com.heer.gymnasium.util.StringUtils;
import com.zhihuiyun.library.utils.L;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by yan on 2018/1/16.
 * 私教列表item实体类
 */

public class CoachBean extends BaseBean {
    private String coach_id;
    private String coach_name;
    private String price;
    private String is_hot;
    private List<String> category_list;
    private String avatar;
    private String area;
    private String eval;
    private String one_time;
    private String sign;
    private String intr;
    private int focus_id;
    private List<String> tag_list;

    public String getCoach_id() {
        return coach_id;
    }

    public void setCoach_id(String coach_id) {
        this.coach_id = coach_id;
    }

    public String getCoach_name() {
        return coach_name;
    }

    public void setCoach_name(String coach_name) {
        this.coach_name = coach_name;
    }

    public String getPrice() {
        return price;
    }

    public void setPrice(String price) {
        this.price = price;
    }

    public String getIs_hot() {
        return is_hot;
    }

    public void setIs_hot(String is_hot) {
        this.is_hot = is_hot;
    }

    public List<String> getCategory_list() {
        return category_list;
    }

    public void setCategory_list(List<String> category_list) {
        this.category_list = category_list;
    }

    public String getAvatar() {
        return avatar;
    }

    public void setAvatar(String avatar) {
        this.avatar = avatar;
    }

    public String getArea() {
        return area;
    }

    public void setArea(String area) {
        this.area = area;
    }

    public String getEval() {
        return eval;
    }

    public void setEval(String eval) {
        this.eval = eval;
    }

    public String getOne_time() {
        return one_time;
    }

    public void setOne_time(String one_time) {
        this.one_time = one_time;
    }

    public String getSign() {
        return sign;
    }

    public void setSign(String sign) {
        this.sign = sign;
    }

    public List<String> getTag_list() {
        return tag_list;
    }

    public void setTag_list(List<String> tag_list) {
        this.tag_list = tag_list;
    }

    public String getIntr() {
        return intr;
    }

    public void setIntr(String intr) {
        this.intr = intr;
    }

    //    数据转换
    public static List<CoachBean> dataChange(List<CoachResponseBean.Item> data) {
        List<CoachBean> beanList = new ArrayList<>();

        if (data != null) {
            for (int i = 0; i < data.size(); i++) {
                CoachBean bean = new CoachBean();
                CoachResponseBean.Item item = data.get(i);
                bean.setCoach_id(item.getCoach_id());
                bean.setCoach_name(item.getCoach_name());
                bean.setPrice(item.getPrice());
                bean.setIs_hot(item.getIs_hot());
                bean.setCategory_list(item.getCategory_list());
                bean.setArea(item.getArea());
                bean.setAvatar(item.getAvatar());
                bean.setEval(item.getEval());
                beanList.add(bean);
            }
        }
        return beanList;
    }

    public static CoachBean dataChange(CoachResponseBean.Item data){
        CoachBean bean = new CoachBean();
        bean.setCoach_id(data.getCoach_id());
        bean.setCoach_name(data.getCoach_name());
        bean.setPrice(data.getPrice());
        bean.setAvatar(data.getAvatar() == null ? "" : data.getAvatar().replace("\\","/"));
        bean.setArea(data.getArea());
        bean.setEval(data.getEval());
        bean.setIs_hot(data.getIs_hot());
        bean.setSign(data.getSign());
        bean.setOne_time(data.getOne_time());
        bean.setCategory_list(data.getCategory_list() == null ? new ArrayList<String>() : data.getCategory_list());
        bean.setIntr(data.getIntr());
        bean.setFocus_id(StringUtils.toInt(data.getFocus_id()));
        if (data.getTag_list() == null){
            bean.setTag_list(new ArrayList<String>());
        }else {
            List<String> list = new ArrayList<String>();
            for (GlobeBean.Tag tag : data.getTag_list()){
                list.add(tag.getName());
            }
            bean.setTag_list(list);
        }

        return  bean;
    }

    public int getFocus_id() {
        return focus_id;
    }

    public void setFocus_id(int focus_id) {
        this.focus_id = focus_id;
    }

    @Override
    public String toString() {
        return "CoachBean{" +
                "coach_id='" + coach_id + '\'' +
                ", coach_name='" + coach_name + '\'' +
                ", price='" + price + '\'' +
                ", is_hot='" + is_hot + '\'' +
                ", category_list=" + category_list +
                ", avatar='" + avatar + '\'' +
                ", area='" + area + '\'' +
                ", eval='" + eval + '\'' +
                '}';
    }
}
